package com.aididi;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@EnableDiscoveryClient
@RefreshScope	//该注解作用于当远程配置文件修改后，能动态刷新文件内容,
				// 但弊端需要 post 方式请求 "http://ip:port/actuator/bus-refresh" 才能看到效果
public class ConfigClinetApplication {

	public static void main(String[] args) {
		SpringApplication.run(ConfigClinetApplication.class, args);
	}

	@Value("${foo}")
	String foo;

	@GetMapping("/config/info")
	public String hai(){
		return foo;
	}

}
